    // pre-define fields in the form
	var name = new Ext.form.TextField({
        fieldLabel: 'Nombre',
        allowBlank: false,
		blankText: 'El campo es requerido',
        name: 'name',
        anchor: '90%' 
    });
    
	var description = new Ext.form.TextField({
        fieldLabel: 'Descripcion',
        allowBlank: false,
        name: 'description',
        anchor: '90%'  
    });  

	var client = new Ext.form.TextField({
        fieldLabel: 'Cliente',
        allowBlank: false,
		vtype: 'alpha',
        name: 'client',
        anchor: '90%'  
    });

    var start = new Ext.form.DateField({
        fieldLabel: 'Inicio',           
        name: 'start',
        format:'Y/m/d',
        anchor: '60%'   
    });  
    
	var end = new Ext.form.DateField({
        fieldLabel: 'Fin',           
        name: 'end',
        format:'Y/m/d',
        anchor: '60%'   
    });

    var formPanel = new Ext.form.FormPanel({  
		id: 'add-project-panel',
        frame: true,
        title:'Agregar Proyecto',
		collapsible: true,
		region: 'east',
        labelAlign: 'right',
        labelWidth: 85,
        width:300,
		height: 300,
        waitMsgTarget: true,
		url:'/projects',

        items: [
            name, 
            description,
            client,
            start,
            end   
		]
    });
	
	
	
	formPanel.addButton({
        text: 'Agregar',		
        handler: function(){
            //fs.form.submit({url:'xml-errors.xml', waitMsg:'Saving Data...'});
			if (formPanel.form.isValid()) {
				xmlDocument = '<?xml version="1.0" encoding="UTF-8" ?><project>';
				xmlDocument += '<name>'+name.getValue()+'</name>';
				xmlDocument += '<description>'+description.getValue()+'</description>';
				xmlDocument += '<client>'+client.getValue()+'</client>';
				xmlDocument += '<start>'+start.getValue()+'</start>';
				xmlDocument += '<end>'+end.getValue()+'</end>';
				xmlDocument += '</project>'
				alert(xmlDocument);
				$.ajax({
				  type: "post",
				  url: "/projects",
				  dataType: "xml",
				  data:{xml: xmlDocument},
				  success: function(xml){
								Ext.MessageBox.alert('Exito', 'El Proyecto fue agregado');
								ds.reload();
							}
				});
				
				//Ext.Ajax.request({url:'/projects', method:'delete', xmlData: xml, success: function(request){alert(request.responseText);}});
				
				/*
	 		        formPanel.form.submit({			      
			            waitMsg:'In processing',
			            failure: function(form, action) {
						    Ext.MessageBox.alert('Error Message', action.result.errorInfo);
						}
			        });
*/					
            } else{
					Ext.MessageBox.alert('Errores', 'Por favor, arregla los errores.');
			}
        }
    });
	
	//formPanel.render('form-project');
	//name.focus();

